#ifndef __FLOPPY_H_f57dbdf4eeb6488ba57a26c18f8494d3__
#define __FLOPPY_H_f57dbdf4eeb6488ba57a26c18f8494d3__

#include "stdint.h"

enum FLOPPY_PORT
{
	FLOPPY_DOR_PORT = 0x3f2,
	FLOPPY_MSR_PORT = 0x3f4,
	FLOPPY_DATA_PORT = 0x3f5,
	FLOPPY_DIR_PORT = 0x3f7,
	FLOPPY_DCR_PORT = 0x3f7
};

void i86_floppy_dma_initialize(uint16_t physicalAddress,uint16_t length,bool readOrWrite);
uint8_t i86_floppy_check_msr();
void i86_floppy_data_send_command(uint8_t cmd);
uint8_t i86_floppy_data_read();
void i86_floppy_write_dor(uint8_t value);
void i86_floppy_control_motor(bool b);
void i86_floppy_write_dcr(uint8_t value);
void i86_floppy_sensei(uint8_t *st0,uint8_t *track);
void i86_floppy_wait_irq();
void i86_floppy_irq_handler();
void i86_floppy_recalibrate(uint8_t drive);
void i86_floppy_seek(uint8_t head,uint8_t drive,uint8_t track);
void i86_floppy_lba_to_chs(int lba,int *head,int *track,int *sector);
uint8_t *i86_floppy_read_sector(int sectorLBA,uint8_t drive);
void i86_floppy_write_sector(int sectorLBA,uint8_t drive);
void i86_floppy_specify(uint8_t stepf,uint8_t huloadt,uint8_t hloadt,bool isDMA);
void i86_floppy_disable_controller();
void i86_floppy_enable_controller();
void i86_floppy_reset();
void i86_floppy_set_working_drive(uint8_t drive);
uint8_t i86_floppy_get_working_drive();
void i86_floppy_initialize();

#endif